package com.ln.lnzw.adapter;

import android.support.annotation.Nullable;
import android.view.ViewGroup;
import android.widget.TextView;

import com.blankj.utilcode.util.ScreenUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ln.lnzw.R;
import com.ln.lnzw.bean.MaterialDirBean;

import java.util.List;

/**
 * 作者 : wlt
 * 创建时间:  2018-05-05
 * QQ : 1346947404
 * 邮箱:wanglt_android@163.com
 * 类说明:我的材料库首页文件夹列表适配器
 * In me the tiger sniffs the rose
 */

public class MaterialDirAdapter extends BaseQuickAdapter<MaterialDirBean.ResultBean.ListBean,BaseViewHolder> {

    private TextView tv_cailiaoku_include;
    private TextView tv_cailiaoku_rename;
    private TextView tv_cailiaoku_delete;

    public MaterialDirAdapter(int layoutResId, @Nullable List<MaterialDirBean.ResultBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MaterialDirBean.ResultBean.ListBean item) {

        tv_cailiaoku_include = helper.getView(R.id.tv_cailiaoku_include);

        ViewGroup.LayoutParams params1 = tv_cailiaoku_include.getLayoutParams();
        params1.width = ScreenUtils.getScreenWidth()/5;
        params1.height = params1.width*2/5;
        tv_cailiaoku_include.setLayoutParams(params1);

        tv_cailiaoku_rename = helper.getView(R.id.tv_cailiaoku_rename);

        ViewGroup.LayoutParams params2 = tv_cailiaoku_rename.getLayoutParams();
        params2.width = ScreenUtils.getScreenWidth()/5;
        params2.height = params2.width*2/5;
        tv_cailiaoku_rename.setLayoutParams(params2);

        tv_cailiaoku_delete = helper.getView(R.id.tv_cailiaoku_delete);

        ViewGroup.LayoutParams params3 = tv_cailiaoku_delete.getLayoutParams();
        params3.width = ScreenUtils.getScreenWidth()/5;
        params3.height = params3.width*2/5;
        tv_cailiaoku_delete.setLayoutParams(params3);


        helper.setText(R.id.tv_dirname,item.getDirName())
                .addOnClickListener(R.id.tv_cailiaoku_include)
                .addOnClickListener(R.id.tv_cailiaoku_rename)
                .addOnClickListener(R.id.tv_cailiaoku_delete);

    }


}
